﻿using System.IO;

namespace OpenLS.Spreadsheet.Formats.Biff.Records
{
    internal struct DXFProt
    {
        private bool _fHidden;
        private bool _fLocked;

        public bool? Locked
        {
            get { return _fLocked; }
        }

        public bool? Hidden
        {
            get {
                return _fHidden;
            }
        }

        public void Read(BinaryReader reader)
        {
            ushort u = reader.ReadUInt16();
            _fLocked = (u & 0x01) != 0;
            _fHidden = (u & 0x02) != 0;
        }

        public void Write(BinaryWriter writer)
        {
            ushort u = 0;
            if (_fLocked)
                u |= 0x01;
            if (_fHidden)
                u |= 0x02;
            writer.Write(u);
        }
    }
}